# -*- coding: utf-8 -*-

from static.extension import db


class User(db.Model):
    __tablename__ = 'users'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    username = db.Column(db.String(255), nullable=False)
    password = db.Column(db.String(255), nullable=False)

    @staticmethod
    def init_db():
        rets = [
            (1, '001', 'xsdqwew'),
            (2, '002', 'xagrgrgre')
        ]
        for ret in rets:
            user = User()
            user.id = ret[0]
            user.username = ret[1]
            user.password = ret[2]
            db.session.add(user)
        db.session.commit()
